import threading
import time

def work(*args,**kwargs):
    # 获取当前线程名称
    name = threading.current_thread().name
    # 打印接收的参数
    print(f"{name} args:",args)
    print(f"{name} kwargs:",kwargs)
    print(f"Thread {name} started")
    # 执行指定次数的循环任务
    for i in range(kwargs['count']):
        print(f"{name}{kwargs['work']}") # 输出工作内容
        time.sleep(1) # 模拟耗时操作

task1 = threading.Thread(target=work,name="Thread1",args=(1,2,3),kwargs={'count':3, 'work':'singing...'}) # 线程1参数：执行3次唱歌
task2 = threading.Thread(target=work,name="Thread2",args=(4,5,6),kwargs={'count':5, 'work':'dancing...'}) # 线程2参数：执行5次跳舞
# 启动线程
task1.start()
task2.start()
# 等待线程结束
task1.join()
task2.join()
# 最终输出
print("All threads finished")